//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity;
using EntLibContrib.Resource.Configuration.Unity;
using EntLibContrib.Resource.Providers;

namespace EntLibContrib.Resource.Configuration
{
	/// <summary>
	/// Configuration data defining AssemblyResourceProviderData. This configuration section adds the assembly name
	/// and resource base name of the Resource assembly.
	/// </summary>    
	[Assembler(typeof(AssemblyResourceProviderAssembler))]
	[ContainerPolicyCreator(typeof(AssemblyResourceProviderPolicyCreator))]
	public class AssemblyResourceProviderData : ResourceProviderData
	{
		#region Constants
		private const string resourceAssemblyNameProperty = "resourceAssemblyName";
		#endregion

		#region Properties
		/// <summary>
		/// Name of the Assembly to use.
		/// </summary>
		/// <value>The name of the resource assembly.</value>
		[ConfigurationProperty(resourceAssemblyNameProperty, IsRequired = true)]
		public string ResourceAssemblyName
		{
			get { return (string)base[resourceAssemblyNameProperty]; }
			set { base[resourceAssemblyNameProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="AssemblyResourceProviderData"/> class.
		/// </summary>
		public AssemblyResourceProviderData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="AssemblyResourceProviderData"/> class.
		/// </summary>
		/// <param name="name">The name of the <see cref="AssemblyResourceProviderData"/>.</param>
		/// <param name="resourceAssemblyName">Name of the resource assembly.</param>
		/// <param name="resourceBaseName">Name of the resource base.</param>
		public AssemblyResourceProviderData(string name, string resourceAssemblyName, string resourceBaseName)
			: base(name, typeof(AssemblyResourceProvider), resourceBaseName)
		{
			this.ResourceAssemblyName = resourceAssemblyName;
		}
		#endregion
	}
}